<template>
    <div class='imageViewItems'>
        <div class="demo-image__lazy">
            <el-image v-for="url in srcList" :key="url" :src="url" lazy></el-image>
        </div>
    </div>
</template>
<script>
export default {
    name:'imageViewItemYtj',
    props:['images','heights','id','data','index','isreadonly',"appid","label"],
   
    data(){
        return{
            url:'https://cube.elemecdn.com/6/94/4d3ea53c084bad6931a56d5158a48jpeg.jpeg',
            showViewer:true,
            dialogVisible2:false,
            showType:"main",
            ids:[],
            lablels:[],
            rstId:"",
            currentValue:"",
            srcList:[]
        }
    },
    created(){
        let ids=this.id.split(".");
        if(ids.length>1){
            this.p=ids[0];
            this.id_=ids[1];
            if(this.index||this.index=='0'){
                try{
                    this.currentValue=this.data[this.p][this.index][this.id_];
                }catch(e){}
            }else{
                try{
                    this.currentValue=this.data[this.p][this.id_];
                }catch(e){}
            }
            
            let images=this.currentValue.split(",");
            this.srcList=[];
            for(let i=0;i<images.length;i++){
                if(images[i]){
                   
                    this.srcList.push(images[i]);
                }
                
            }
        }
    },
    methods:{
        closeViewer() {
          this.showViewer = false
        },
        closes(){
            this.dialogVisible2=false;
        },
        mainDevs(id){
            this.dialogVisible2=true;
            this.showType="main";
            this.rstId=id;
        },  
        childDevs(id){
            this.dialogVisible2=true;
            this.showType="child";
        },
        uploadImg(data){
            console.log("rstId==="+this.rstId);
            console.log(this.$refs[this.rstId])
            this.$refs[this.rstId][0].uploadImg(data)
            //this.uploaded(JSON.parse(data));
        }
    }
}
</script>
<style>
.imageViewItems{
    width:100%;
}
.imageViewItemchild{
    display:inline-block;
}
.el-image{
    display:block !important;
    width:70%;
    margin-left:15%;
}
</style>